﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Slippor.Douban.Radio.Assist.CustomControls
{
    public partial class DockPanel : UserControl
    {
        private String _dockText = String.Empty;
        public String DockText
        {
            get { return _dockText; }
            set { _dockText = value; labelDock.Text = value;}
        }

        public Image IconImage
        {
            get { return pictureBoxIcon.Image; }
            set { pictureBoxIcon.Image = value; }
        }

        public DockPanel()
        {
            InitializeComponent();
        }

        public void UpdateDockLayout()
        {
           switch(this.Dock)
           {
               case DockStyle.Bottom:
                   pictureBoxIcon.Dock = DockStyle.Left;
                   labelDock.Dock = DockStyle.Fill;
                   labelDock.Padding = new Padding(17,1,1,1);
                   labelDock.TextAlign = ContentAlignment.MiddleCenter;
                   break;
               case DockStyle.Right:
                   labelDock.TextAlign = ContentAlignment.MiddleCenter;
                   labelDock.Dock = DockStyle.Fill;
                   labelDock.Padding = new Padding(1, 17, 1, 1);
                   pictureBoxIcon.Dock = DockStyle.Top;
                   break;
               case DockStyle.Left:
                   labelDock.TextAlign = ContentAlignment.MiddleCenter;
                   labelDock.Dock = DockStyle.Fill;
                   labelDock.Padding = new Padding(1, 17, 1, 1);
                   pictureBoxIcon.Dock = DockStyle.Top;
                   break;
           }
        }
    }
}
